by Michael Morrison
In This Chapter
Multimedia has become a critical part of many Windows applications. There was a time when multimedia applied only to games and special multimedia presentations. However, multimedia content is now used extensively in business applications such as TurboTax and Microsoft Money, not to mention the many uses of multimedia on the Web. As an MFC developer, you should be prepared to leverage some degree of multimedia content in applications that you develop.
This chapter explores multimedia and how it affects MFC application development. You learn about the DirectX Media Player control, as well as how to use DirectSound to add multimedia sound capabilities to applications.
Multimedia is probably one of the most overused terms in the history of computing. Interestingly enough, many users dont even understand exactly what the term means. Multimedia refers to the different types of content displayed and interacted with in an application. In a general sense, any application content that contains audio or video elements could be considered multimedia content. However, Id like to make a clearer distinction between multimedia content and other application content.
In general, multimedia content can be defined as audio, video, or other content that is time based, which means that the content changes over time. This definition of multimedia eliminates static content such as still images. This isnt meant to lessen the importance of images in Windows applications. Rather, Im trying to get the point across that multimedia content encompasses a specific type of data. Keep in mind that static images could still fit in to a multimedia presentation as components of an animation that is time based. However, this definition of multimedia requires that the images be changed or altered over time.
Practically all games are considered multimedia applications because of their heavy use of multimedia content. There are also multimedia applications that ship with Windows 95/98. The CD Player and Sound Recorder applications are multimedia applications used to play CDs and record audio clips. You could even think of Microsoft Word and some other productivity applications as multimedia applications because its possible to embed audio and video clips within Word documents. Web browsers are also very good examples of multimedia applications because they can be used to view a wide range of media content.
Chapter 30, MFC and DirectX, introduces you to DirectX, which is designed to allow applications to simultaneously display and manipulate 2D and 3D graphics, animation, video, and surround sound, as well as support advanced user input devices. DirectX figures heavily into Windows multimedia content. In fact, DirectX forms the basis of every Windows multimedia technology. This wasnt always the caseearlier versions of Windows supported different types of multimedia content with completely different technologies. DirectX serves as the integration of all the tools and programming interfaces for the playback and capture of multimedia content.
One particular facet of DirectX that is extremely valuable for working with media content is the DirectX Media Player control, which is an ActiveX control that is part of the DirectX Media layer. The Media Player control is based on the DirectShow component of the DirectX Media layer and is used solely for the playback of multimedia content. The Media Player control acts as a universal player for most standard multimedia formats, including both streaming and nonstreaming media content. This makes the Media Player control extremely versatile; you can use the control in both applications and Web pages.
The Media Player control supports the following streaming media formats, which are typically used for playback over a network:
Note:Advanced Streaming Format (ASF) is Microsofts standard streaming media format recommended for use with the Media Player control. An ASF file is capable of storing both audio and video and is specially designed to be used over networks such as the Internet. ASF media content is delivered as a continuous flow of data with minimal wait time before playback begins.
The Media Player control also supports the following nonstreaming media formats, which are typically used for local playback:
As with all ActiveX controls, you interact with the Media Player control by setting properties and calling member functions on the control. You can also respond to events that are generated by the control. Because the control is implemented as an ActiveX control, you can interact with it from applications written in a variety of languages or from a scripting language in a Web page. Using the properties and member functions exposed by the control, you can
The Media Player control is used as the basis for the Windows Media Player application that ships with Windows 98. The Windows Media Player application uses the standard user interface provided by the Media Player control and enables you to open and play the different types of media supported by the control. This application is a good example of how the Media Player control can be used to play back media content. Figure 31.1 shows the Windows Media Player application in action.
Figure 31.1 The Windows Media Player application that uses the Media Player control.
Note:For more extensive information on the DirectX Media Player control, check out Microsofts Windows Media Web site at http://www.microsoft.com/windows/windowsmedia/.